#ifndef _INFOBLOCK_H
#define _INFOBLOCK_H

#include "user_config.h"
//
#define TGT_SIZE                            0x0C
//
#define FLASH_SIG_OFFSET_ADDRESS            0x0000B    //  >0x200(中断向量表地址)

/* Define the address from where user application will be loaded.
   Note: the 1st sector 0x08000000-0x08007FFF is reserved for the IAP code */
#define APPLICATION_ADDRESS                 0x08008000
#define APPLICATION_END_ADDRESS             0x0801DFFF

#define TGT_APP_INFOBLOCK_ADDRESS           (APPLICATION_END_ADDRESS - TGT_SIZE + 1)

// Defines for use in the InfoBlock
#define TGT_APP_INFOBLOCK_LENGTH            7

#define TGT_DEVICE_CODE             0x10

#if (PCB_VERSION < PCB_A2)
    #define TGT_MCU_CODE            0x32
#elif (PCB_VERSION == PCB_A2)
    #define TGT_MCU_CODE            0x33
#elif (PCB_VERSION == PCB_A3)
    #define TGT_MCU_CODE            0x34
#else
    #error "TGT_PRODUCT_CODE not defined"
#endif

#define TGT_BL_TYPE                 0x01   // UART BL
#define TGT_FLASH_PAGE_SIZE_CODE    11     // Flash Page Size Code: 2^11 => 2048 bytes

// 产品版本说明
//  0.1x    生产调试版本, PCB A1
//  0.2x    生产调试版本, PCB A2
//  1.x     正式产品版本, PCB A1
//  2.x     正式产品版本, PCB A2

#define VER_HI_A1_DEBUG             0
#define VER_LO_A1_DEBUG             10

#define VER_HI_A2_DEBUG             0
#define VER_LO_A2_DEBUG             20

#define VER_HI_A1                   1
#define VER_LO_A1                   2

#define VER_HI_A2                   2
#define VER_LO_A2                   1

#if (PCB_A1 == PCB_VERSION)
    #define APP_FW_VERSION_HIGH     VER_HI_A1
    #define APP_FW_VERSION_LOW      VER_LO_A1
#elif (PCB_VERSION == PCB_A2)
    #define APP_FW_VERSION_HIGH     VER_HI_A2
    #define APP_FW_VERSION_LOW      VER_LO_A2
#endif//PRODUCT_DEBUG

#define	BL_SPECIFIC_BYTE            0x25

// Signature Bytes
#define SIG_BYTE0                   0x3D
#define SIG_BYTE1                   0xC2
#define SIG_BYTE2                   0xA5
#define SIG_BYTE3                   0x1B

#endif//_INFOBLOCK_H
